package com.wander.patterns.act.memento;

import lombok.Data;

/**
 * @description:源发器
 * @author: zhuyong
 * @create: 2019-09-11 17:44
 **/
@Data
public class Emp {

    String name;

    int age;

    int salary;

    EmpMemento empMemento;

    public void setMemento(EmpMemento empMemento){
        empMemento.setName(this.getName());
        empMemento.setAge(this.getAge());
        empMemento.setSalary(this.getSalary());
    }

    public void recovery(){
        this.name = empMemento.getName();
        this.age = empMemento.getAge();
        this.salary = empMemento.getSalary();
    }

    public Emp(String name, int age, int salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public Emp() {
    }
}
